<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
  </head>
  <body onload="init()">
    <button onclick="clickme()">有种点我试试</button>
    <div id="clickResult"></div>
    <div id="result"></div>
    <script>
      var arr = [
        "你竟然真的点了",
        "真乖",
        "你还来",
        "啊，你够了",
        "我要叫我大哥了",
        "再点我怕我死机了",
        "在这么下去webWorker要觉醒了",
        "准备迎接我大哥的怒火吧"
      ];
      var i = 0;
      function clickme() {
        document.getElementById("clickResult").innerHTML += arr[i] + "<br>";
        i++;
        if (i > 7) {
          i = 7;
        }
      }
      function timedCount() {
        var i = 0;
        for (var j = 0, sum = 0; j < 100; j++) {
          for (var i = 0; i < 100000000; i++) {
            sum += i;
          }
        }
        return sum;
      }
      function init() {
        document.getElementById("result").innerHTML +=
          "大哥去打怪, " + new Date().toLocaleString() + "<br>";
        var sum = timedCount();
        document.getElementById("result").innerHTML += sum + "<br/>";
        document.getElementById("result").innerHTML +=
          "大哥打怪回来, " + new Date().toLocaleString();
      }
    </script>
  </body>
</html>
